<!DOCTYPE html>
<html>

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Sugar</title>
</head>

<body>
  <h1>检测字符串中是否包含某个特殊字段</h1>
  <script>

    /* 检测字符串中是否包含某个特殊字段 */

    // 传统写法 indexOf
    const res1 = 'iOS 13.2.3'.indexOf('iOS') > -1;
    // ES6 新增的 includes
    const res2 = 'iOS 13.2.3'.includes('iOS');

    console.log('indexOf', res1);
    console.log('includes', res2);
  </script>
</body>

</html>